home *** CD-ROM | disk | FTP | other *** search
/ isnet Internet / Isnet Internet CD.iso / prog / hiz / 09 / 09.exe / adynware.exe / perl / lib / site / Devel / DProf.pm next >
Encoding:
Perl POD Document  |  1999-12-28  |  3.0 KB  |  108 lines

  1. require 5.003;
  2.  
  3. =head1 NAME
  4.  
  5. Devel::DProf - a Perl code profiler
  6.  
  7. =head1 SYNOPSIS
  8.  
  9.     perl5 -d:DProf test.pl
  10.  
  11. =head1 DESCRIPTION
  12.  
  13. The Devel::DProf package is a Perl code profiler.  This will collect
  14. information on the execution time of a Perl script and of the subs in that
  15. script.  This information can be used to determine which subroutines are
  16. using the most time and which subroutines are being called most often.  This
  17. information can also be used to create an execution graph of the script,
  18. showing subroutine relationships.
  19.  
  20. To profile a Perl script run the perl interpreter with the B<-d> debugging
  21. switch.  The profiler uses the debugging hooks.  So to profile script
  22. F<test.pl> the following command should be used:
  23.  
  24.     perl5 -d:DProf test.pl
  25.  
  26. When the script terminates the profiler will dump the profile information to
  27. a file called F<tmon.out>.  A tool like I<dprofpp> can be used to interpret
  28. the information which is in that profile.  The following command will print
  29. the top 15 subroutines which used the most time:
  30.  
  31.     dprofpp
  32.  
  33. To print an execution graph of the subroutines in the script use the
  34. following command:
  35.  
  36.     dprofpp -T
  37.  
  38. Consult L<dprofpp> for other options.
  39.  
  40. =head1 PROFILE FORMAT
  41.  
  42. The profile is a text file which looks like this:
  43.  
  44.     $hz=100;
  45.     $XS_VERSION='DProf 19970606';
  46.     $rrun_utime=2; $rrun_stime=0; $rrun_rtime=7
  47.     PART2
  48.     + 26 28 566822884 DynaLoader::import
  49.     - 26 28 566822884 DynaLoader::import
  50.     + 27 28 566822885 main::bar
  51.     - 27 28 566822886 main::bar
  52.     + 27 28 566822886 main::baz
  53.     + 27 28 566822887 main::bar
  54.     - 27 28 566822888 main::bar
  55.     [....]
  56.  
  57. The first line is the magic number.  The second line is the hertz value, or
  58. clock ticks, of the machine where the profile was collected.  The third line
  59. is the name and version identifier of the tool which created the profile.
  60. The fourth line is a comment.  The fifth line contains three variables
  61. holding the user time, system time, and realtime of the process while it was
  62. being profiled.  The sixth line indicates the beginning of the sub
  63. entry/exit profile section.
  64.  
  65. The columns in B<PART2> are:
  66.  
  67.     sub entry(+)/exit(-) mark
  68.     app's user time at sub entry/exit mark, in ticks
  69.     app's system time at sub entry/exit mark, in ticks
  70.     app's realtime at sub entry/exit mark, in ticks
  71.     fully-qualified sub name, when possible
  72.  
  73. =head1 AUTOLOAD
  74.  
  75. When Devel::DProf finds a call to an C<&AUTOLOAD> subroutine it looks at the
  76. C<$AUTOLOAD> variable to find the real name of the sub being called.  See
  77. L<perlsub/"Autoloading">.
  78.  
  79. =head1 BUGS
  80.  
  81. XSUBs, builtin functions, and destructors cannot be measured by Devel::DProf.
  82.  
  83. Mail bug reports and feature requests to the perl5-porters mailing list at
  84. F<E<lt>perl5-porters@africa.nicoh.comE<gt>>.
  85.  
  86. =head1 SEE ALSO
  87.  
  88. L<perl>, L<dprofpp>, times(2)
  89.  
  90. =cut
  91.  
  92. package DB;
  93.  
  94.  
  95. BEGIN { $single = 0; }
  96.  
  97. sub DB { 
  98. }
  99.  
  100.  
  101. require DynaLoader;
  102. @Devel::DProf::ISA = 'DynaLoader';
  103. $Devel::DProf::VERSION = '19970614'; # this version not authorized by
  104.  
  105. bootstrap Devel::DProf $Devel::DProf::VERSION;
  106.  
  107. 1;
  108.